package com.myccb.app.widget;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.myccb.app.R;

/**
 * Created by hyt on 2017/12/13.
 */

public class CommonDialog extends Dialog {

    private TextView textViewMsg;

    private TextView btnOk;

    private TextView textViewTips;

    View.OnClickListener onOkBtnClickListener;

    public CommonDialog(@NonNull Context context) {
        super(context, R.style.LoadingCountdownDialogTheme);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.common_dialog_layout);
        textViewMsg=findViewById(R.id.common_dialog_msg);
        textViewTips=findViewById(R.id.common_dialog_tips);
        btnOk=findViewById(R.id.common_dialog_btn1);
        btnOk.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }


    public void showMessage(String msg){
        super.show();
        textViewMsg.setText(msg);
    }

    public void showMessage(String msg,String tips){
        super.show();
        textViewMsg.setText(msg);
        textViewTips.setText(tips);
    }

    public void setOnOkBtnClickListener(View.OnClickListener onOkBtnClickListener){
        btnOk.setOnClickListener(onOkBtnClickListener);
    }



}
